/*   CODE WRITTEN BY AI

Input to AI:
Write a RISC program to calculate 20 values of he Fibonacci series
using a start value of 7. 
 
Use cout to show title and values
*/


// Fibonacci series
// Starting values: 7, 7
// Display 20 values
start:
addi x1, x0, 7       // x1 = previous value
addi x2, x0, 7       // x2 = current value
addi x3, x0, 18      // 18 additional values required

cout << "FIBONACCI SERIES" << endl;
cout << "Starting value: 7" << endl;
cout << endl;

cout << x1 << endl;  // Display first value
cout << x2 << endl;  // Display second value

loop:
add  x4, x1, x2      // Calculate next value

cout << x4 << endl;  // Display next value

add  x1, x2, x0      // Previous = current
add  x2, x4, x0      // Current = next

addi x3, x3, -1      // One fewer value remaining
bne  x3, x0, loop    // Continue until 20 are displayed

cout << endl;
cout << "END OF SERIES" << endl;
